<!DOCTYPE HTML>
<html>
<head>
		<?php
		include("include.php");
		
		//login::loginAction();
		//echo 'logged in<br/>';
		
		// get the current date
		$date = ourDate::getDateString();
		//echo 'have date<br/>';
		
		//get the user id from our cookie
		$ID = userHelper::getUserID();
		//echo 'have user id<br/>';
		
		//get 6 upcoming events for the front page
		$recentUpcomingEvents = eventHelper::getUsersUpcomingEvents($ID, 4);
		
		//get users recom
		$recomEvents = eventHelper::getUserRecomEvents($ID);
	?>
</head>
<body>

<div class="container">
	<div id="header">
		<?php include("banner.php")?>
		
		<div id="login">
			<?php login::displayLoginDiv(); ?>
		</div>
		
		<div class="clear"></div>
		
		<div id="navigation">
			<?php include('navigation.php'); ?>
		</div>
	</div>
	
	<div class="clear"></div>
	
	<div id="body">
		<div id="content">
			<h1>Recent Upcoming Events</h1>
			<?php 
			if(empty($recentUpcomingEvents))
			{
				echo '<p>No Recent Upcoming Events</p>';
			}
			else
			{
				foreach($recentUpcomingEvents as $ID => $event)
				{
				?>
					<div class="event">
						<div class="image">
							<img src="<?php echo $event['IMAGE_PATH']; ?>" />
						</div>
						<div class="text">
							<h2><a href="event.php?eventID=<?php echo $ID;?>"><?php echo $event['NAME']; ?></a></h2>
							<p>Location: <?php echo $event['LOCATION']; ?></p>
							<p>When: <?php echo ourDate::formatDate($event['START_TIME']); ?></p>
							<p>Description: <?php echo substr($event['DESCRIPTION'], 0, 100)." . . ."; ?></p>
						</div>
					</div>
					
							<div class="clear"></div>
				<?php 
				}
			}
			?>
							
		<!-- Recommendations -->
			<fieldset>
				<legend>Recommendations</legend>
				<?php foreach($recomEvents as $ID => $event)
				{ ?>
					<div class="similarEvent">
					<img src="<?php echo $event['IMAGE_PATH']; ?>" />
						<h2><a href="event.php?eventID=<?php echo $ID;?>"><?php echo $event['NAME']; ?></a></h2>
						<p><?php echo $event['LOCATION']; ?></p>
						<p><?php echo ourDate::formatDate($event['START_TIME']); ?></p>
						<p><?php echo substr($event['DESCRIPTION'], 0, 60)." . . .";?></p>
					</div>
				<?php
				} ?>
			</fieldset>
		
		</div>
		
		<div id="tags">
			<h1>Tags</h1>
			<?php tag::displayTagCloud(); ?>
		</div>
		
		<div id="fblike">
			<?php include "facebookLike.php"; ?>
        </div>
	
	</div>
	
	<div class="clear"></div>
	
	<div id="footer">
		<?php include("footer.php"); ?>
	</div>

</div>


</body>
</html>
